<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />

    <title>xmake v2.6.2 发布，新增 Linux 内核驱动模块构建支持</title>
    <meta name="description" content="Xmake 是一个基于 Lua 的轻量级跨平台构建工具。它非常的轻量，没有任何依赖，因为它内置了 Lua 运行时。它使用 xmake.lua 维护项目构建，相比 makefile/CMakeLists.txt，配置语法更加简洁直观，对新手非常友好，短时间内就能快速入门，能够让用户把更多的精力集中在实际的项目开发上...">

    
    <meta name="keywords" content="xmake,lua,C/C++,Linux,Driver,tboox" /> 

    <!-- qq oauth -->
    <meta property="qc:admins" content="5211601217706727767255" />

    <!--icon -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" sizes="192x192" href="/static/img/nice-highres.png" />
	<link rel="apple-touch-icon-precomposed" href="/static/img/apple-touch-icon-57x57-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/apple-touch-icon-72x72-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/apple-touch-icon-114x114-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/apple-touch-icon-144x144-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="180x180" href="/static/img/retinahd_icon.png" />
	<meta name="msapplication-TileImage" content="/static/img/retinahd_icon.png" />
	
    <link rel="stylesheet" href=" /css/fontawesome/css/font-awesome.min.css ">
    <link rel="stylesheet" href=" /css/main.css ">
    <link rel="canonical" href="https://tboox.org/cn/2021/12/17/xmake-update-v2.6.2/">
    <link rel="alternate" type="application/rss+xml" title="TBOOX Open Source Project" href="https://tboox.org/feed.xml ">
    <link rel="alternate" hreflang="en" href="https://tboox.org/" />
    <link rel="alternate" hreflang="zh-Hans" href="https://tboox.org/cn/" />

    <!-- css -->
    <link href="/css/reward.css" rel="stylesheet" type="text/css"> 




    <script type="text/javascript">
    function isPC(){    
        var userAgentInfo = navigator.userAgent;  
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");    
        var flag = true;    
        for (var v = 0; v < Agents.length; v++) {    
            if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }    
        }    
        return flag;    
    }
    </script>

<!-- baidu ads -->



    <!-- baidu ads -->

</head>


  <body>

    <header id="top">
    <div class="wrapper">
        <a href="/cn" class="brand">TBOOX</a>
        <button id="headerMenu" class="menu"><i class="fa fa-bars"></i></button>
        <nav id="headerNav">
            <ul>
                <li>
                    
                    <a href="/?lang=0">
                    
                        <i class="fa fa-home"></i>English
                    </a>
                </li>

                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/project/">
                            
                        
                            <i class="fa fa-bookmark"></i>项目
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/archive/">
                            
                        
                            <i class="fa fa-archive"></i>归档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/category/">
                            
                        
                            <i class="fa fa-th-list"></i>分类
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/tag/">
                            
                        
                            <i class="fa fa-tags"></i>标记
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/docs/">
                            
                        
                            <i class="fa fa-book"></i>文档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="https://xmake.io/#/zh-cn/about/contact" target="_blank" >
                            
                        
                            <i class="fa fa-forumbee"></i>社区
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/donation/">
                            
                        
                            <i class="fa fa-heart"></i>捐助
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/about/">
                            
                        
                            <i class="fa fa-user"></i>关于
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            </ul>
        </nav>
    </div>
</header>



        <div class="page clearfix" post>
    <div class="left">
        <h1>xmake v2.6.2 发布，新增 Linux 内核驱动模块构建支持</h1>
        <div class="label">

            <div class="label-card">
                <i class="fa fa-calendar"></i>2021-12-17
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
            


<!-- <span class="point">•</span> -->
<span class="categories">
  <i class="fa fa-th-list"></i>
  
    
        <a href="/category/#xmake" title="Category: xmake" rel="category">xmake</a>
    
  

  <!-- <span class="point">•</span> -->
</span>


            </div>

            <div class="label-card">
            
<!-- <span class="point">•</span> -->
<span class="pageTag">
  <i class="fa fa-tags"></i>
  
    
        <!--a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a-->
        <a href="/cn/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a>&nbsp;
    
        <!--a href="/tag/#lua" title="Tag: lua" rel="tag">lua</a-->
        <a href="/cn/tag/#lua" title="Tag: lua" rel="tag">lua</a>&nbsp;
    
        <!--a href="/tag/#C%2FC%2B%2B" title="Tag: C/C++" rel="tag">C/C++</a-->
        <a href="/cn/tag/#C/C++" title="Tag: C/C++" rel="tag">C/C++</a>&nbsp;
    
        <!--a href="/tag/#Linux" title="Tag: Linux" rel="tag">Linux</a-->
        <a href="/cn/tag/#Linux" title="Tag: Linux" rel="tag">Linux</a>&nbsp;
    
        <!--a href="/tag/#Driver" title="Tag: Driver" rel="tag">Driver</a-->
        <a href="/cn/tag/#Driver" title="Tag: Driver" rel="tag">Driver</a>
    
  

</span>

            </div>

        </div>
        <hr>
        <article itemscope itemtype="http://schema.org/BlogPosting">
        <p><a href="https://github.com/xmake-io/xmake">Xmake</a> 是一个基于 Lua 的轻量级跨平台构建工具。</p>

<p>它非常的轻量，没有任何依赖，因为它内置了 Lua 运行时。</p>

<p>它使用 xmake.lua 维护项目构建，相比 makefile/CMakeLists.txt，配置语法更加简洁直观，对新手非常友好，短时间内就能快速入门，能够让用户把更多的精力集中在实际的项目开发上。</p>

<p>我们能够使用它像 Make/Ninja 那样可以直接编译项目，也可以像 CMake/Meson 那样生成工程文件，另外它还有内置的包管理系统来帮助用户解决 C/C++ 依赖库的集成使用问题。</p>

<p>目前，Xmake 主要用于 C/C++ 项目的构建，但是同时也支持其他 native 语言的构建，可以实现跟 C/C++ 进行混合编译，同时编译速度也是非常的快，可以跟 Ninja 持平。</p>

<div class="highlighter-rouge"><pre class="highlight"><code>Xmake = Build backend + Project Generator + Package Manager
</code></pre>
</div>

<ul>
  <li><a href="https://github.com/xmake-io/xmake">项目源码</a></li>
  <li><a href="https://xmake.io/#/zh-cn/">官方文档</a></li>
  <li><a href="https://xmake.io/#/zh-cn/about/course">入门课程</a></li>
</ul>

<p><img src="https://tboox.org/static/img/xmake/xmake-cmake.jpeg" width="30%" /></p>

<h2 id="新版本改动">新版本改动</h2>

<p>这个版本主要新增两大特性：</p>

<ol>
  <li>Linux 内核驱动模块的构建支持</li>
  <li>分组构建和批量运行支持，可用于实现 <code class="highlighter-rouge">Run all tests</code> 功能</li>
</ol>

<p>剩下的主要是一些零散的功能改进和 Bugs 修复，可以看下文末的更新内容明细，一些比较大的改动，下面也会逐一说明。</p>

<h2 id="新特性介绍">新特性介绍</h2>

<h3 id="构建-linux-内核驱动模块">构建 Linux 内核驱动模块</h3>

<p>Xmake 也许是首个提供 Linux 内核驱动开发 内置支持的第三方构建工具了。</p>

<p>尽管网上也有介绍 CMake 如何去配置构建 linux 驱动，但是大都是通过 <code class="highlighter-rouge">add_custom_command</code> 方式自定义各种命令，然后执行 <code class="highlighter-rouge">echo</code> 去自己拼接生成 Linux 的 Makefile 文件。</p>

<p>也就是说，其实还是依赖 Linux 内核源码的 Makefile 来执行的构建，因此如果想自己追加一些编译配置和宏定义都会非常麻烦。</p>

<p>而使用 Xmake，我们可以提供更加灵活的可配置性，更加简单的配置文件，以及一键编译、自动依赖拉取集成、Linux kernel 源码自动下载集成，内核驱动交叉编译等特性。</p>

<h4 id="hello-world">Hello World</h4>

<p>我们通过一个最简单的字符驱动来直观感受下。</p>

<p>首先，我们准备一个 Hello World 驱动代码，例如：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"linux-headers"</span><span class="p">,</span> <span class="p">{</span><span class="n">configs</span> <span class="o">=</span> <span class="p">{</span><span class="n">driver_modules</span> <span class="o">=</span> <span class="kc">true</span><span class="p">}})</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"hello"</span><span class="p">)</span>
    <span class="n">add_rules</span><span class="p">(</span><span class="s2">"platform.linux.driver"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"linux-headers"</span><span class="p">)</span>
    <span class="n">set_license</span><span class="p">(</span><span class="s2">"GPL-2.0"</span><span class="p">)</span>
</code></pre>
</div>

<p>它的配置非常简单，只需要配置上支持模块的 linux-headers 包，然后应用 <code class="highlighter-rouge">platform.linux.driver</code> 构建规则就行了。</p>

<p>然后直接执行 xmake 命令，一键编译，生成内核驱动模块 hello.ko。</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code><span class="w">$ </span><span class="nc">xmake</span><span class="kv">
</span>[ 20%]: ccache compiling.release src/add.c
[ 20%]: ccache compiling.release src/hello.c
[ 60%]: linking.release build/linux/x86_64/release/hello.ko
[100%]: build ok!
</code></pre>
</div>

<p>简单么，也许你会说，这跟直接用 Makefile 配置，然后 make 编译也没啥太大区别么。</p>

<p>那么重点来了，Xmake 是会自动帮你拉取指定版本依赖内核源码，make 不会，CMake 也不会，用户必须通过 <code class="highlighter-rouge">sudo apt install linux-headers-generic</code> 自己安装它们。</p>

<p>但是 Xmake 不需要，上面的一键编译，我其实省略了部分输出，实际上是这样的。</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code><span class="w">$ </span><span class="nc">xmake</span><span class="kv">
</span>note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
  -&gt; m4 1.4.19 [from:linux-headers,bison,flex,elfutils]
  -&gt; flex 2.6.4 [from:bc,linux-headers]
  -&gt; bison 3.8.2 [from:bc,linux-headers]
  -&gt; ed 1.17 [from:bc,linux-headers]
  -&gt; texinfo 6.7 [from:bc,linux-headers]
  -&gt; bc 1.07.1 [from:linux-headers]
  -&gt; pkg-config 0.29.2 [from:linux-headers]
  -&gt; openssl 1.1.1l [private, from:linux-headers]
  -&gt; elfutils 0.183 [private, from:linux-headers]
  -&gt; linux-headers 5.10.46 [driver_modules:y]
please input: y (y/n/m)

  =&gt; download https://github.com/xmake-mirror/ed/archive/refs/tags/1.17.tar.gz .. ok
  =&gt; install ed 1.17 .. ok
  =&gt; download https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.xz .. ok
  =&gt; download https://ftp.gnu.org/gnu/texinfo/texinfo-6.7.tar.xz .. ok
  =&gt; download https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz .. ok
  =&gt; download https://github.com/openssl/openssl/archive/OpenSSL_1_1_1l.zip .. ok
  =&gt; install m4 1.4.19 .. ok
  =&gt; download https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz .. ok
  =&gt; install texinfo 6.7 .. ok
  =&gt; install pkg-config 0.29.2 .. ok
  =&gt; download http://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.gz .. ok
  =&gt; install flex 2.6.4 .. ok
  =&gt; download https://sourceware.org/elfutils/ftp/0.183/elfutils-0.183.tar.bz2 .. ok
  =&gt; install elfutils 0.183 .. ok
  =&gt; install bison 3.8.2 .. ok
  =&gt; download https://ftp.gnu.org/gnu/bc/bc-1.07.1.tar.gz .. ok
  =&gt; install bc 1.07.1 .. ok
  =&gt; install openssl 1.1.1l .. ok
  =&gt; download https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.46.tar.xz .. ok
  =&gt; install linux-headers 5.10.46 .. ok
[ 16%]: ccache compiling.release src/add.c
[ 16%]: ccache compiling.release src/hello.c
[ 16%]: ccache compiling.release src/hello.mod.c
[ 66%]: linking.release build/linux/x86_64/release/hello.ko
[100%]: build ok!
</code></pre>
</div>

<p>首次编译，Xmake 会拉取所有依赖，如果用户自己已经通过 apt 等第三方包管理安装了它们，Xmake 也会优先用系统已经安装的版本，省去下载安装过程。</p>

<p>也就是说，不管在哪个环境，用户都不需要关心如何去搭建内核驱动开发环境，仅仅只需要一个 <code class="highlighter-rouge">xmake</code> 命令，就能搞定一切。</p>

<p>而这些依赖拉取，都是通过 <code class="highlighter-rouge">add_requires("linux-headers", {configs = {driver_modules = true}})</code> 配置包来实现的。</p>

<p>另外，我们也可以看完整构建命令参数。</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code><span class="w">$ </span><span class="nc">xmake</span><span class="kv"> -v
</span>[ 20%]: ccache compiling.release src/add.c
/usr/bin/ccache /usr/bin/gcc -c -m64 -O2 -std=gnu89 -I/usr/src/linux-headers-5.11.0-41-generic/arch/x86/include -I/usr/src/linux-headers-5.11.0-41-generic/arch/x86/include/generated -I/usr/src/linux-headers-5.11.0-41-generic/include -I/usr/src/linux-headers-5.11.0-41-generic/arch/x86/include/uapi -I/usr/src/linux-headers-5.11.0-41-generic/arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.11.0-41-generic/include/uapi -I/usr/src/linux-headers-5.11.0-41-generic/include/generated/uapi -D__KERNEL__ -DMODULE -DKBUILD_MODNAME=\"hello\" -DCONFIG_X86_X32_ABI -isystem /usr/lib/gcc/x86_64-linux-gnu/10/include -include /usr/src/linux-headers-5.11.0-41-generic/include/linux/kconfig.h -include /usr/src/linux-headers-5.11.0-41-generic/include/linux/compiler_types.h -nostdinc -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -mindirect-branch=thunk-extern -mindirect-branch-register -mrecord-mcount -fmacro-prefix-map=./= -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -fcf-protection=none -falign-jumps=1 -falign-loops=1 -fno-asynchronous-unwind-tables -fno-jump-tables -fno-delete-null-pointer-checks -fno-allow-store-data-races -fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining -fstack-protector-strong -fno-inline-functions-called-once -falign-functions=32 -fno-strict-overflow -fno-stack-check -fconserve-stack -DKBUILD_BASENAME=\"add\" -o build/.objs/hello/linux/x86_64/release/src/add.c.o src/add.c
[ 20%]: ccache compiling.release src/hello.c
/usr/bin/ccache /usr/bin/gcc -c -m64 -O2 -std=gnu89 -I/usr/src/linux-headers-5.11.0-41-generic/arch/x86/include -I/usr/src/linux-headers-5.11.0-41-generic/arch/x86/include/generated -I/usr/src/linux-headers-5.11.0-41-generic/include -I/usr/src/linux-headers-5.11.0-41-generic/arch/x86/include/uapi -I/usr/src/linux-headers-5.11.0-41-generic/arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.11.0-41-generic/include/uapi -I/usr/src/linux-headers-5.11.0-41-generic/include/generated/uapi -D__KERNEL__ -DMODULE -DKBUILD_MODNAME=\"hello\" -DCONFIG_X86_X32_ABI -isystem /usr/lib/gcc/x86_64-linux-gnu/10/include -include /usr/src/linux-headers-5.11.0-41-generic/include/linux/kconfig.h -include /usr/src/linux-headers-5.11.0-41-generic/include/linux/compiler_types.h -nostdinc -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -mindirect-branch=thunk-extern -mindirect-branch-register -mrecord-mcount -fmacro-prefix-map=./= -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -fcf-protection=none -falign-jumps=1 -falign-loops=1 -fno-asynchronous-unwind-tables -fno-jump-tables -fno-delete-null-pointer-checks -fno-allow-store-data-races -fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining -fstack-protector-strong -fno-inline-functions-called-once -falign-functions=32 -fno-strict-overflow -fno-stack-check -fconserve-stack -DKBUILD_BASENAME=\"hello\" -o build/.objs/hello/linux/x86_64/release/src/hello.c.o src/hello.c
[ 60%]: linking.release build/linux/x86_64/release/hello.ko
/usr/bin/ld -m elf_x86_64 -r -o build/.objs/hello/linux/x86_64/release/build/linux/x86_64/release/hello.ko.o build/.objs/hello/linux/x86_64/release/src/add.c.o build/.objs/hello/linux/x86_64/release/src/hello.c.o
/usr/src/linux-headers-5.11.0-41-generic/scripts/mod/modpost -m -a -o build/.objs/hello/linux/x86_64/release/build/linux/x86_64/release/Module.symvers -e -N -T -
WARNING: modpost: Symbol info of vmlinux is missing. Unresolved symbol check will be entirely skipped.
/usr/bin/ccache /usr/bin/gcc -c -m64 -O2 -std=gnu89 -I/usr/src/linux-headers-5.11.0-41-generic/arch/x86/include -I/usr/src/linux-headers-5.11.0-41-generic/arch/x86/include/generated -I/usr/src/linux-headers-5.11.0-41-generic/include -I/usr/src/linux-headers-5.11.0-41-generic/arch/x86/include/uapi -I/usr/src/linux-headers-5.11.0-41-generic/arch/x86/include/generated/uapi -I/usr/src/linux-headers-5.11.0-41-generic/include/uapi -I/usr/src/linux-headers-5.11.0-41-generic/include/generated/uapi -D__KERNEL__ -DMODULE -DKBUILD_MODNAME=\"hello\" -DCONFIG_X86_X32_ABI -isystem /usr/lib/gcc/x86_64-linux-gnu/10/include -include /usr/src/linux-headers-5.11.0-41-generic/include/linux/kconfig.h -include /usr/src/linux-headers-5.11.0-41-generic/include/linux/compiler_types.h -nostdinc -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -mindirect-branch=thunk-extern -mindirect-branch-register -mrecord-mcount -fmacro-prefix-map=./= -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -fcf-protection=none -falign-jumps=1 -falign-loops=1 -fno-asynchronous-unwind-tables -fno-jump-tables -fno-delete-null-pointer-checks -fno-allow-store-data-races -fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining -fstack-protector-strong -fno-inline-functions-called-once -falign-functions=32 -fno-strict-overflow -fno-stack-check -fconserve-stack -o build/.objs/hello/linux/x86_64/release/build/linux/x86_64/release/hello.ko.mod.o build/.objs/hello/linux/x86_64/release/build/linux/x86_64/release/hello.ko.mod.c
/usr/bin/ld -m elf_x86_64 -r --build-id=sha1 -T /usr/src/linux-headers-5.11.0-41-generic/scripts/module.lds -o build/linux/x86_64/release/hello.ko build/.objs/hello/linux/x86_64/release/build/linux/x86_64/release/hello.ko.o build/.objs/hello/linux/x86_64/release/build/linux/x86_64/release/hello.ko.mod.o
</code></pre>
</div>

<h4 id="使用特定版本的内核源码">使用特定版本的内核源码</h4>

<p>我们也可以指定版本语义规则，选取自己需要的内核源码作为构建源。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"linux-headers 5.9.x"</span><span class="p">,</span> <span class="p">{</span><span class="n">configs</span> <span class="o">=</span> <span class="p">{</span><span class="n">driver_modules</span> <span class="o">=</span> <span class="kc">true</span><span class="p">}})</span>
</code></pre>
</div>

<h4 id="交叉编译">交叉编译</h4>

<p>我们也支持内核驱动模块的交叉编译，比如在 Linux x86_64 上使用交叉编译工具链来构建 Linux Arm/Arm64 的驱动模块。</p>

<p>我们只需要准备好自己的交叉编译工具链，通过 <code class="highlighter-rouge">--sdk=</code> 指定它的根目录，然后配置切换到 <code class="highlighter-rouge">-p cross</code> 平台， 最后指定需要构建的架构 arm/arm64 即可。</p>

<p>同样的，我们不用关心如何准备 linux-headers 去支持交叉编译，Xmake 的依赖包管理会帮你准本好一切，拉取构建支持对应架构的内核源码。</p>

<p>这里用到的交叉工具链，可以从这里下载: <a href="https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/">Download toolchains</a></p>

<p>更多，交叉编译配置文档，见：<a href="https://xmake.io/#/zh-cn/guide/configuration?id=common-cross-compilation-configuration">配置交叉编译</a></p>

<p>注：目前仅仅支持 arm/arm64 交叉编译架构，后续会支持更多的平台架构。</p>

<h5 id="构建-arm-驱动模块">构建 Arm 驱动模块</h5>

<div class="language-console highlighter-rouge"><pre class="highlight"><code><span class="w">$ </span><span class="nc">xmake</span><span class="kv"> f -p cross -a arm --sdk=/mnt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf -c
</span><span class="w">$ </span><span class="nc">xmake</span><span class="kv">
</span>[ 20%]: ccache compiling.release src/add.c
[ 20%]: ccache compiling.release src/hello.c
[ 60%]: linking.release build/cross/arm/release/hello.ko
[100%]: build ok!

</code></pre>
</div>

<h5 id="构建-arm64-驱动模块">构建 Arm64 驱动模块</h5>

<div class="language-console highlighter-rouge"><pre class="highlight"><code><span class="w">$ </span><span class="nc">xmake</span><span class="kv"> f -p cross -a arm64 --sdk=/mnt/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu -c
</span><span class="w">$ </span><span class="nc">xmake</span><span class="kv">
</span>[ 20%]: ccache compiling.release src/add.c
[ 20%]: ccache compiling.release src/hello.c
[ 60%]: linking.release build/cross/arm64/release/hello.ko
[100%]: build ok!
</code></pre>
</div>

<h3 id="分组批量构建和运行支持">分组批量构建和运行支持</h3>

<p>早期，我们已经支持了通过 <code class="highlighter-rouge">set_group</code> 设置目标分组，实现 vs/vsxmake 工程在 vs 下的源文件分组管理展示。</p>

<p>但是，这个分组仅限于这个特性，没有用于其他地方，而新版本中，我们继续改进利用分组特性，实现指定构建一批目标程序，以及批量运行一批目标程序。</p>

<p>这通常有什么用呢，比如可以用来提供 <code class="highlighter-rouge">Run all tests</code> 和 <code class="highlighter-rouge">Run all benchmarks</code> 等功能。</p>

<h4 id="编译指定一批目标程序">编译指定一批目标程序</h4>

<p>我们可以使用 <code class="highlighter-rouge">set_group()</code> 将给定的目标标记为 <code class="highlighter-rouge">test/benchmark/...</code> 并使用 <code class="highlighter-rouge">set_default(false)</code> 禁用来默认构建它。</p>

<p>这样，默认情况下 Xmake 不会去构建它们，但是我们可以通过 <code class="highlighter-rouge">xmake -g xxx</code> 命令就能指定构建一批目标程序了。</p>

<p>比如，我们可以使用此功能来构建所有测试。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test1"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">set_default</span><span class="p">(</span><span class="kc">false</span><span class="p">)</span>
    <span class="n">set_group</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.cpp"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test2"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">set_default</span><span class="p">(</span><span class="kc">false</span><span class="p">)</span>
    <span class="n">set_group</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.cpp"</span><span class="p">)</span>
</code></pre>
</div>

<div class="language-console highlighter-rouge"><pre class="highlight"><code><span class="w">$ </span><span class="nc">xmake</span><span class="kv"> -g test
</span><span class="w">$ </span><span class="nc">xmake</span><span class="kv"> --group=test
</span></code></pre>
</div>

<h4 id="运行指定一批目标程序">运行指定一批目标程序</h4>

<p>我们也可以通过设置分组，来指定运行所有带有 <code class="highlighter-rouge">test</code> 分组的测试程序。</p>

<p>这通常非常有用，在此之前想要实现 <code class="highlighter-rouge">Run all tests</code> 功能，我们只能通过定义一个 <code class="highlighter-rouge">task("tests")</code> 在里面调用 <code class="highlighter-rouge">os.exec</code> 去挨个执行测试目标，配置比较繁琐，对用户要求比较高。</p>

<p>而现在，我们只需要对需要执行的测试目标程序标记为 <code class="highlighter-rouge">set_group("test")</code>，然后就可以批量运行它们了。</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code><span class="w">$ </span><span class="nc">xmake</span><span class="kv"> run -g test
</span><span class="w">$ </span><span class="nc">xmake</span><span class="kv"> run --group=test
</span></code></pre>
</div>

<h4 id="支持分组模式匹配">支持分组模式匹配</h4>

<p>另外，我们还可以支持分组的模式匹配，非常的灵活：</p>

<div class="highlighter-rouge"><pre class="highlight"><code>$ xmake build -g test_*
$ xmake run -g test/foo_*
$ xmake build -g bench*
$ xmake run -g bench*
</code></pre>
</div>

<p>更多信息见：<a href="https://github.com/xmake-io/xmake/issues/1913">#1913</a></p>

<h3 id="改进-cmake-包源的查找和集成">改进 CMake 包源的查找和集成</h3>

<p>之前的版本中，我们提供了 <code class="highlighter-rouge">find_package("cmake::xxx")</code> 来查找 cmake 内部的包，但是这种方式对于用户集成使用还是很繁琐。</p>

<p>因此，新版本中，我们进一步改进它，通过 <code class="highlighter-rouge">add_requires</code> 来实现统一快速的 cmake 包集成。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"cmake::ZLIB"</span><span class="p">,</span> <span class="p">{</span><span class="n">alias</span> <span class="o">=</span> <span class="s2">"zlib"</span><span class="p">,</span> <span class="n">system</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"zlib"</span><span class="p">)</span>
</code></pre>
</div>

<p>我们指定 <code class="highlighter-rouge">system = true</code> 告诉 xmake 强制从系统中调用 cmake 查找包，如果找不到，不再走安装逻辑，因为 cmake 没有提供类似 vcpkg/conan 等包管理器的安装功能，
只提供了包查找特性。</p>

<h4 id="指定版本">指定版本</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"cmake::OpenCV 4.1.1"</span><span class="p">,</span> <span class="p">{</span><span class="n">system</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
</code></pre>
</div>

<h4 id="指定组件">指定组件</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"cmake::Boost"</span><span class="p">,</span> <span class="p">{</span><span class="n">system</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="n">configs</span> <span class="o">=</span> <span class="p">{</span><span class="n">components</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"regex"</span><span class="p">,</span> <span class="s2">"system"</span><span class="p">}})}</span>
</code></pre>
</div>

<h4 id="预设开关">预设开关</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"cmake::Boost"</span><span class="p">,</span> <span class="p">{</span><span class="n">system</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="n">configs</span> <span class="o">=</span> <span class="p">{</span><span class="n">components</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"regex"</span><span class="p">,</span> <span class="s2">"system"</span><span class="p">},</span>
                                             <span class="n">presets</span> <span class="o">=</span> <span class="p">{</span><span class="n">Boost_USE_STATIC_LIB</span> <span class="o">=</span> <span class="kc">true</span><span class="p">}}})</span>
</code></pre>
</div>

<p>相当于内部调用 find_package 查找包之前，在 CMakeLists.txt 中预定义一些配置，控制 find_package 的查找策略和状态。</p>

<div class="highlighter-rouge"><pre class="highlight"><code>set(Boost_USE_STATIC_LIB ON) -- will be used in FindBoost.cmake
find_package(Boost REQUIRED COMPONENTS regex system)
</code></pre>
</div>

<h4 id="设置环境变量">设置环境变量</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"cmake::OpenCV"</span><span class="p">,</span> <span class="p">{</span><span class="n">system</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="n">configs</span> <span class="o">=</span> <span class="p">{</span><span class="n">envs</span> <span class="o">=</span> <span class="p">{</span><span class="n">CMAKE_PREFIX_PATH</span> <span class="o">=</span> <span class="s2">"xxx"</span><span class="p">}}})</span>
</code></pre>
</div>

<h4 id="指定自定义-findfoocmake-模块脚本目录">指定自定义 FindFoo.cmake 模块脚本目录</h4>

<p>mydir/cmake_modules/FindFoo.cmake</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"cmake::Foo"</span><span class="p">,</span> <span class="p">{</span><span class="n">system</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="n">configs</span> <span class="o">=</span> <span class="p">{</span><span class="n">moduledirs</span> <span class="o">=</span> <span class="s2">"mydir/cmake_modules"</span><span class="p">}})</span>
</code></pre>
</div>

<p>相关 issues: <a href="https://github.com/xmake-io/xmake/issues/1632">#1632</a></p>

<h3 id="xmake-idea-插件更新">xmake-idea 插件更新</h3>

<p><a href="https://github.com/xmake-io/xmake-idea">xmake-idea</a> 这个插件由于个人时间和精力的关系，一直没有花时间去维护更新，而 IDEA 插件的兼容性问题有非常多，只要一段时间不用，就无法在新的 Idea/Clion 上正常使用。</p>

<p>最近，我花了点时间，修复了一些兼容性问题，比如 Windows 上创建工程会卡死的问题，新版本 Clion 无法安装等问题。</p>

<p>目前，最新版本应该可以在全平台正常使用了。</p>

<p><img src="https://tboox.org/static/img/xmake/xmake-idea-output_panel.png" width="50%" /></p>

<h2 id="另外一些值得提起的事情">另外一些值得提起的事情</h2>

<h3 id="年终总结">年终总结</h3>

<p>这是 2021 年我发布的最后一个版本，这一年下来，经历了很多，Xmake 也在逐渐成长为一个更加强大的构建工具。</p>

<p>到今年年底，Xmake 总共收获了 4.2k stars，处理了 1.9k 的 issues/pr，超过 8k 多次 commits。</p>

<p><img src="https://tboox.org/static/img/xmake/xmake-star-history.png" width="50%" /></p>

<p>而官方的包管理仓库 <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a> 也已经收录了近 500+ 的常用依赖包。</p>

<h3 id="感谢">感谢</h3>

<p>感谢各位贡献者对 xmake-repo 仓库 和 Xmake 的贡献，完整贡献者列表见：<a href="https://github.com/xmake-io/xmake/graphs/contributors">Contributors</a>。</p>

<p>也非常感谢大家对 Xmake 的赞助的支持，使得我能够有足够的动力去持续维护，完整捐助列表见：<a href="https://xmake.io/#/zh-cn/about/sponsor">Sponsors</a>。</p>

<h2 id="更新内容">更新内容</h2>

<h3 id="新特性">新特性</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/1902">#1902</a>: 支持构建 linux 内核驱动模块</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1913">#1913</a>: 通过 group 模式匹配，指定构建和运行一批目标程序</li>
</ul>

<h3 id="改进">改进</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/1872">#1872</a>: 支持转义 set_configvar 中字符串值</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1888">#1888</a>: 改进 windows 安装器，避免错误删除其他安装目录下的文件</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1895">#1895</a>: 改进 <code class="highlighter-rouge">plugin.vsxmake.autoupdate</code> 规则</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1893">#1893</a>: 改进探测 icc 和 ifort 工具链</li>
  <li><a href="https://github.com/xmake-io/xmake/pull/1905">#1905</a>: 改进 msvc 对 external 头文件搜索探测支持</li>
  <li><a href="https://github.com/xmake-io/xmake/pull/1904">#1904</a>: 改进 vs201x 工程生成器</li>
  <li>添加 <code class="highlighter-rouge">XMAKE_THEME</code> 环境变量去切换主题配置</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1907">#1907</a>: 添加 <code class="highlighter-rouge">-f/--force</code> 参数使得 <code class="highlighter-rouge">xmake create</code> 可以在费控目录被强制创建</li>
  <li><a href="https://github.com/xmake-io/xmake/pull/1917">#1917</a>: 改进 find_package 和配置</li>
</ul>

<h3 id="bugs-修复">Bugs 修复</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/1885">#1885</a>: 修复 package:fetch_linkdeps 链接顺序问题</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1903">#1903</a>: 修复包链接顺序</li>
</ul>


        </article>
        <hr>

        <!-- baidu ads -->
        

        <!-- reward -->
        <div style="text-align: center;">
            <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
              <span>赏</span>
            </button>
            <div id="QR" style="display: none;">
                <div id="wechat" style="display: inline-block">
                  <img id="wechat_qr" src="/static/img/weixin.png" alt="WeChat Pay"/>
                  <p>微信打赏</p>
                </div>
                <div id="alipay" style="display: inline-block">
                  <img id="alipay_qr" src="/static/img/alipay.png" alt="Alipay"/>
                  <p>支付宝打赏</p>
                </div>
            </div>
        </div>

        
        
            
            
                
                    
                    <h2 id="english">English</h2>
                    <ul>
                    
                    <li class="relatedPost">
                        <a href="/2021/12/17/xmake-update-v2.6.2/">Xmake v2.6.2 released, Support building Linux kernel driver module
                        
                        </a>
                    </li>
                    
                    
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
        
            </ul>
        

        
        
            
        
            
        
            
            
            
                
                    
                        
                        <h2 id="similar_posts">相关文章</h2>
                        <ul>
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/12/03/xmake-update-v2.6.1/">xmake v2.6.1 发布，使用 Lua5.4 运行时，Rust 和 C++ 混合编译支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/10/30/xmake-update-v2.5.9/">xmake v2.5.9 发布，改进 C++20 模块，并支持 Nim, Keil MDK 和 Unity Build
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/10/08/xmake-update-v2.5.8/">xmake v2.5.8 发布，新增 Pascal/Swig 程序和 Lua53 运行时支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/08/29/xmake-update-v2.5.7/">xmake v2.5.7 发布，包依赖锁定和 Vala/Metal 语言编译支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
        
            </ul>
        

        <div class="post-recent">
    <div class="pre">

        

        

        
        
        

        

        

        
        
        <p><strong>上一篇</strong> <a href="/cn/2021/12/03/xmake-update-v2.6.1/">xmake v2.6.1 发布，使用 Lua5.4 运行时，Rust 和 C++ 混合编译支持</a></p>
        
    </div>

    <div class="nex">

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        

        

        

        

        

        
        
        

        
    </div>
</div>


        <h2 id="comments">评论</h2>
        






<div id="gitalk-container"></div>
<link rel="stylesheet" href="/css/gitalk.css">
<script src="/js/gitalk.min.js"></script>

<script>
const gitalk = new Gitalk({
  clientID: '73946dc1d9e2276ad0da',
  clientSecret: '12a3cb94361ba3ebc6ecb68cf80d592bfaa8106d',
  repo: 'tboox.github.io',
  owner: 'waruqi',
  admin: ['waruqi'],
  id: location.pathname,       
  language: 'zh-CN',
  distractionFreeMode: false  
})

gitalk.render('gitalk-container')
</script>





    </div>
    <button class="anchor"><i class="fa fa-anchor"></i></button>
    <div class="right">
        <div class="wrap">

            <!-- codefund ads -->
            

            <!-- Content -->
            <div class="side content">
                <div>
                    内容
                </div>
                <ul id="content-side" class="content-ul">
                    <li><a href="#english">English</a></li>
                    <li><a href="#similar_posts">相关文章</a></li>
                    <li><a href="#comments">评论</a></li>
                </ul>
            </div>


            <!-- baidu ads -->
            
            
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    链接
                </div>
                <ul class="content-ul">
                  <li><a href="http://github.com/waruqi/tbox">tbox</a></li>
                  <li><a href="http://www.xmake.io">xmake</a></li>
                  <li><a href="https://github.com/waruqi">github</a></li>
                </ul>
            </div> 

            <!-- xmake courses -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    xmake 入门课程
                </div>
                <a href="https://xmake.io/#/zh-cn/about/course" target="_blank">
                <img src="/static/img/xmake-course.png" alt="course" width="256" height="193">
                </a>
            </div>

            <!-- qqgroup -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    技术交流群（QQ）
                </div>
                <img src="/static/img/qqgroup.png" alt="qqgroup" width="256" height="284">
            </div> 

            <!-- google ads -->
            

            <!-- baidu ads -->
            

        </div>
    </div>

    <!-- baidu ads -->
    
</div>
<script>
/**
 * target _blank
 */
(function() {
    var aTags = document.querySelectorAll('article a:not([id])')
    for (var i = 0; i < aTags.length; i++) {
        aTags[i].setAttribute('target', '_blank')
    }
}());
</script>
<script src="/js/pageContent.js " charset="utf-8"></script>



    <footer class="site-footer">
    <div class="wrapper">
        <p class="description">
             Copyright (c) 2016-2020 tboox.org 
        </p>
        <p class="contact">
            
            <a href="https://github.com/waruqi" title="GitHub"><i class="fa fa-github" aria-hidden="true"></i></a> 
             
            
            <a href="mailto:waruqi@gmail.com" title="email"><i class="fa fa-envelope-o" aria-hidden="true"></i></a> 
            
            
            <a href="https://twitter.com/waruqi" title="Twitter"><i class="fa fa-twitter" aria-hidden="true"></i></a> 
            
            <a href="/feed.xml" title="feed"><i class="fa fa-feed" aria-hidden="true"></i></a> 
        </p>
        <p class="power">
            <span>
                Site powered by <a href="https://jekyllrb.com/">Jekyll</a> & <a href="https://github.com/Gaohaoyang">HyG</a> & <a href="https://pages.github.com/">Github Pages</a>.
            </span>
        </p>
    </div>
</footer>

    <div class="back-to-top">
    <a href="#top" class="scroll">
        <i class="fa fa-arrow-up" aria-hidden="true"></i>
    </a>
</div>

    <script src=" /js/main.js " charset="utf-8"></script>
    <script src=" /js/scroll.min.js " charset="utf-8"></script>
  </body>

</html>
